package com.atwy.storage.mapper;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

@Mapper
public interface StorageMapper {

    @Update("update storage_tbl set count = count - #{count} where commodity_code = #{commodityCode}")
    int deduct(@Param("commodityCode") String commodityCode, @Param("count") int count);

    @Select("select count from storage_tbl where commodity_code = #{commodityCode}")
    int queryCountByCommodityCode(@Param("commodityCode") String commodityCode);

}
